package com.hou.mqacting.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

//配置
@Configuration
public class MessageConfig01 {

    //创建死信交换器
    @Bean
    public DirectExchange dlxchange(){
        return new DirectExchange("dlxchange",true,false);
    }
    @Bean
    public Queue dlxQueue(){
        return new Queue("dlxQueue",true,false,false);
    }
    //通过指定key绑定队列与交换器
    @Bean
    Binding bindingDLXMessages() {
        return BindingBuilder.bind(dlxQueue()).to(dlxchange()).with("dlxKey");
    }



}
